
<?php if($isAjax==0){?>
<script>
$(function() {
	$( "#tabs" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 0
	});
});
</script>
<div id="tabs">
	<ul>
            <li><a href='#pt'>Danh sách phong trào</a> </li>
           <li><?php echo $this->Html->link(__('Thêm phong trào', true), array('controller'=>'phongtraokhoas','action' => 'add',$khoa_id)); ?></li>
    </ul>
<div class="phongtraokhoas index" id="pt">
<h2><?php __('Danh sách các phong trào của khoa');?></h2>
	<?php echo $form->create('Phongtraokhoa');?>
	<table>
	<tr>
	<td><?php echo $form->input('namhoc',array('id'=>'namhoc','options'=>$namhocs,'label'=>'Năm Học','selected'=>$namhocht));?></td>
	<td><div id='hocky'><?php echo $form->input('hocky',array('id'=>'hocky_id','options'=>$hockys,'empty'=>'---Chọn học kỳ---','label'=>'Học Kỳ','selected'=>$hockyht));?></div></td>
	</tr>
	</table>
	<?php echo $form->end();?>
	<div id='phongtrao'>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Cấp PT';?></th>
			<th><?php echo 'Loại PT';?></th>
			<th><?php echo 'Tên PT';?></th>
			<th><?php echo 'Ngày Bắt Đầu';?></th>
			<th><?php echo 'Ngày Kết Thúc';?></th>
			<th><?php echo 'Ghi Chú';?></th>
			<th class="actions"><?php __('Thao tác');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($phongtraokhoas as $phongtraokhoa):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i; ?>&nbsp;</td>
		<td>
			<?php echo $phongtraokhoa['Cap']['tencap']; ?>
		</td>
		<td>
			<?php echo $phongtraokhoa['Loaiphongtrao']['tenloaiphongtrao']; ?>
		</td>
		<td><?php echo $phongtraokhoa['Phongtraokhoa']['tenphongtrao']; ?>&nbsp;</td>
		<td><?php echo date('d-m-Y',strtotime($phongtraokhoa['Phongtraokhoa']['ngaybatdau'])); ?>&nbsp;</td>
		<td><?php echo empty($phongtraokhoa['Phongtraokhoa']['ngayketthuc'])?'': date('d-m-Y',strtotime($phongtraokhoa['Phongtraokhoa']['ngayketthuc'])); ?>&nbsp;</td>
		<td><?php echo $phongtraokhoa['Phongtraokhoa']['ghichu']; ?>&nbsp;</td>
		<td class="actions">
		<?php echo $this->Html->link(__('Thành tích cán bộ', true), array('controller'=>'thanhtichkhoacbs','action' => 'index',$phongtraokhoa['Phongtraokhoa']['id'])); ?>
		<?php echo $this->Html->link(__('Thành tích sinh viên', true), array('controller'=>'thanhtichkhoasvs','action' => 'index',$phongtraokhoa['Phongtraokhoa']['id'])); ?>
			<?php echo $this->Html->link(__('Sửa', true), array('action' => 'edit',$phongtraokhoa['Phongtraokhoa']['khoa_id'],$phongtraokhoa['Phongtraokhoa']['id'])); ?>
			<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete',$phongtraokhoa['Phongtraokhoa']['khoa_id'],$phongtraokhoa['Phongtraokhoa']['id']), null, sprintf(__('Bạn muốn xóa phong trào %s?', true), $phongtraokhoa['Phongtraokhoa']['tenphongtrao'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php $paginator->options(array('url'=>array($khoa_id,$namhocht,$hockyht)));?>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
</div>
<?php
$this->Js->get('#namhoc')->event('change',
							$this->Js->request(array('controller' => 'phongtraokhoas', 'action' => 'updatehk'),
							array('update' => '#hocky','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));
$this->Js->get('#namhoc')->event('change',
							$this->Js->request(array('controller' => 'phongtraokhoas', 'action' => 'index',$khoa_id,$namhocht,$hockyht,1),
							array('update' => '#phongtrao','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));
							
$this->Js->get('#hocky')->event('change',
							$this->Js->request(array('controller' => 'phongtraokhoas', 'action' => 'index',$khoa_id,$namhocht,$hockyht),
							array('update' => '#phongtrao','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true))))); 							
?>
<?php }else{?>
<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Cấp PT';?></th>
			<th><?php echo 'Loại PT';?></th>
			<th><?php echo 'Tên PT';?></th>
			<th><?php echo 'Ngày Bắt Đầu';?></th>
			<th><?php echo 'Ngày Kết Thúc';?></th>
			<th><?php echo 'Ghi Chú';?></th>
			<th class="actions"><?php __('Thao tác');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($phongtraokhoas as $phongtraokhoa):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i; ?>&nbsp;</td>
		<td>
			<?php echo $phongtraokhoa['Cap']['tencap']; ?>
		</td>
		<td>
			<?php echo $phongtraokhoa['Loaiphongtrao']['tenloaiphongtrao']; ?>
		</td>
		<td><?php echo $phongtraokhoa['Phongtraokhoa']['tenphongtrao']; ?>&nbsp;</td>
		<td><?php echo date('d-m-Y',strtotime($phongtraokhoa['Phongtraokhoa']['ngaybatdau'])); ?>&nbsp;</td>
		<td><?php echo empty($phongtraokhoa['Phongtraokhoa']['ngayketthuc'])?'': date('d-m-Y',strtotime($phongtraokhoa['Phongtraokhoa']['ngayketthuc'])); ?>&nbsp;</td>
		<td><?php echo $phongtraokhoa['Phongtraokhoa']['ghichu']; ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Sửa', true), array('action' => 'edit',$phongtraokhoa['Phongtraokhoa']['khoa_id'],$phongtraokhoa['Phongtraokhoa']['id'])); ?>
			<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete',$phongtraokhoa['Phongtraokhoa']['khoa_id'],$phongtraokhoa['Phongtraokhoa']['id']), null, sprintf(__('Bạn muốn xóa phong trào %s?', true), $phongtraokhoa['Phongtraokhoa']['tenphongtrao'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php $paginator->options(array('url'=>array($khoa_id,$namhocht,$hockyht)));?>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
<?php }?>
</div>
